import os

import mysql.connector

redis_db=3
init_token=True
task_mode=False
broker_url = f"redis://:Kean@123@www.xiuwen.work:13361/{ redis_db}"
result_backend = f"redis://:Kean@123@www.xiuwen.work:13361/{ redis_db}"
env_var = os.environ.get('airdata_profile')
conn=None
if env_var == "prod":
    redis_db=4
    init_token=True
    task_mode=True
    broker_url= f"redis://:weigang@127.0.0.1:6379/{ redis_db}"
    result_backend= f"redis://:weigang@127.0.0.1:6379/{ redis_db}"
    conn = mysql.connector.connect(host="127.0.0.1", user="root", password="root", port=8085,
                                   database='kongtiao')
if not conn:
    print("尝试测试环境db")
    conn = mysql.connector.connect(host="www.xiuwen.work", user="kean", password="Kean@123", port=13360,
                                   database='kongtiao')

def getConn():
    print("db conn",conn)
    return conn